/*
package com.wanqh.reptitle.controller;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.date.format.DatePrinter;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists;
import com.wanqh.reptitle.pojo.ProductExcel;
import com.wanqh.reptitle.pojo.SearchResult;
import com.wanqh.reptitle.service.SearchService;
import com.wanqh.reptitle.utils.EasyExcelUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.DateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;

@RestController
@Slf4j
public class SearchController {
    @Autowired
    private List<SearchService> searchServices;

    @PostMapping("uploadFile")
    public void uploadFile(@RequestParam("file") MultipartFile multipartFile, HttpServletRequest request, HttpServletResponse response) throws IOException {
        List<ProductExcel> wu = EasyExcel.read(multipartFile.getInputStream(), ProductExcel.class, null)
                .sheet("吴珊珊")
                .headRowNumber(2)
                .doReadSync();
        Map<String, List<SearchResult>> result = new HashMap<>();
        int i = 3;
        for (ProductExcel productExcel : wu) {
            String brand = productExcel.getBrand();
            if (StrUtil.isEmpty(brand)) {
                continue;
            }
            log.info("第:[{}]行,品牌:[{}]", i, brand);
            for (SearchService searchService : searchServices) {
//                SearchResult searchResult = searchService.ServiceBrand(brand);
//                if (result.containsKey(searchService.getPlatform())) {
//                    result.get(searchService.getPlatform()).add(searchResult);
//                } else {
//                    result.put(searchService.getPlatform(), Lists.newArrayList(searchResult));
//                }
            }
            i++;
            // 休眠
            int randomInt = RandomUtil.randomInt(20, 40);
            log.info("休眠：[{}s]", randomInt);
            ThreadUtil.sleep(randomInt, TimeUnit.SECONDS);
        }
        log.info(JSON.toJSONString(result));
        if (CollUtil.isNotEmpty(result)) {
            EasyExcelUtil.export(response, result, "搜索结果-" + DateUtil.format(new Date(), "yyyyMMddHHmmss"), SearchResult.class);
        }
    }

}
*/
